package pers.vic.upload.business.controller;

import cn.xuqiudong.common.base.model.BaseResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.vic.upload.business.BusinessFacade;
import pers.vic.upload.constant.FileType;

import javax.xml.bind.annotation.XmlRegistry;
import java.util.List;
import java.util.Map;

/**
 * 描述:业务处理controller
 * @author Vic.xu
 * @date 2022-07-29 9:56
 */
@RestController
public class BusinessController {

    @Autowired
    private BusinessFacade businessFacade;

    /**
     * 文件名校验
     * @param filename file name
     * @param type type
     * @return  BaseResponse
     */
    @RequestMapping("/check")
    public BaseResponse<?> check(String filename, FileType type){
        return businessFacade.check(filename, type, false);
    }

    @RequestMapping("/find")
    public BaseResponse<List<Map<String, Object>>> find(FileType type){
        return businessFacade.find( type);
    }

}
